﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Prototipo.CMS.Models;

namespace Prototipo.CMS.Controllers
{
    public class HandlerController : Controller
    {
        public FileResult ResolveCss(string file)
        {
            return File(ViewBag.Configuration.Theme.Path + "content/" + file + ".css", "text/css");
        }

        public FileResult ResolveImage(string file, string ext)
        {
            return File(ViewBag.Configuration.Theme.Path + "content/images/" + file + "." + ext, "image/" + ext);
        }

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            ViewBag.Configuration = new Configuration(Server.MapPath("~/"));

            base.OnActionExecuting(filterContext);
        }
    }
}
